<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="gv-page-container">
  <h1>General</h1>
  <div>
    <div fxLayout="column" fxFlex="70">
      <form (ngSubmit)="update()" #managementForm="ngForm" fxLayout="column">
        <div class="gv-form-section">
          <div class="gv-form-section-title">
            <h5>Identity Providers</h5>
            <small>Identity sources for authenticating and retrieving information about your users.</small>
            <mat-divider></mat-divider>
          </div>
          <div>
          <mat-form-field appearance="outline" floatLabel="always">
            <mat-select placeholder="Identity providers" multiple name="identities" [(ngModel)]="settings.identityProviders" [disabled]="readonly">
              <mat-option *ngFor="let identityProvider of identityProviders" [value]="identityProvider.id">{{ identityProvider.name }}</mat-option>
            </mat-select>
          </mat-form-field>
          </div>
        </div>
        <div class="gv-form-section">
          <div class="gv-form-section-title">
            <h5>Social / Enterprise</h5>
            <small>Social or external sources for authenticating and retrieving information about your users.</small>
            <mat-divider></mat-divider>
          </div>
          <div>
            <mat-form-field appearance="outline" floatLabel="always">
              <mat-select placeholder="Social providers" multiple name="socialIdentities" [(ngModel)]="settings.socialIdentities" [disabled]="readonly">
                <mat-option *ngFor="let socialIdentityProvider of socialIdentities" [value]="socialIdentityProvider.id">{{ socialIdentityProvider.name }}</mat-option>
              </mat-select>
            </mat-form-field>
          </div>
        </div>
        <div *hasPermission="['organization_settings_update']">
          <button mat-raised-button color="primary" [disabled]="(!managementForm.valid || managementForm.pristine)" type="submit">SAVE</button>
        </div>
      </form>
    </div>
    <div class="gv-page-description" fxFlex>
      <h3>Manage the platform settings</h3>
      <div class="gv-page-description-content">
        <p>
          The platform preferences let you configure how your users will connect to the Access Management Admin Portal.
        </p>
      </div>
    </div>
  </div>
</div>
